<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body class="easyui-layout">
<div data-options="region:'north',border:true,title:'会员信息'" style="height:50%;">
	<table id="datagrid" class="easyui-datagrid" data-options="singleSelect:true,fit:true,fitColumns:true,
		pagination:true,pageSize:15,pageList:[5,10,15,20],url:'search',toolbar:'#td', onClickRow:gridClick">
		<thead>
			<tr>
				<th data-options="field:'ID', hidden:true">编号</th>
				<th data-options="field:'M_TRUE_NAME'">姓名</th>
				<th data-options="field:'MPHONE'">手机号</th>
				<th data-options="field:'WEIXIN'">微信号</th>
				<th data-options="field:'CARD_ID'">身份证</th>
				<th data-options="field:'BANK_CARD_ID'">银行卡号</th>
				<th data-options="field:'MONEYS'">未打款金额</th>
				<th data-options="field:'REG_TIME'">注册时间</th>
				<th data-options="field:'EXA_TIME'">审核时间</th>
				<th data-options="field:'CREATE_TIME'">创建时间</th>
			</tr>
		</thead>
	</table>
	<!-- 查询栏 -->
	<div id="td" style="padding:2px 5px;">
		会员姓名：<input type="text" id="s_name" class="easyui-textbox" />&nbsp;&nbsp;
		有未打款<input type="checkbox" id="ckb_dk" value="1" />
		<a href="javascript:void(0)" id="btn_search" class="easyui-linkbutton" iconCls="icon-search">查询</a>
	</div>
</div>
<div data-options="region:'center',border:true,title:'反利信息'" style="height:50%;">
	<input type="hidden" id="userid" value="" />
	<table id="f_datagrid" class="easyui-datagrid" data-options="fit:true,fitColumns:true,
		pagination:true,pageSize:15,pageList:[5,10,15,20],url:'searchPro',toolbar:'#ffd'">
		<thead>
			<tr>
				<th data-options="field:'ID',checkbox:true"></th>
				<th data-options="field:'FROM_USER_NAME'">反利来源会员</th>
				<th data-options="field:'GRADE'">反利级数</th>
				<th data-options="field:'MONEYS'">反利金额</th>
				<th data-options="field:'SH_NAME'">审核人</th>
				<th data-options="field:'CREATE_TIME'">反利时间</th>
				<th data-options="field:'DK_NAME'">打款人</th>
				<th data-options="field:'D_TIME'">打款时间</th>
				<th data-options="field:'BACK_INFO'">结果</th>
			</tr>
		</thead>
	</table>
	<div id="ffd">
		打款结果
		<select id="d_result" class="easyui-combobox" panelHeight="auto" style="width:100px">
            <option value="">全部</option>
            <option value="1">未打</option>
            <option value="2">已打</option>
        </select>
        <a href="javascript:void(0)" id="btn_p_search" class="easyui-linkbutton" iconCls="icon-search">查询</a>
		<br/>
		<a href="javascript:void(0)" id="btn_dk" class="easyui-linkbutton" iconCls="icon-edit">打款</a>
	</div>
</div>
</body>
</html>
<@h.easyui />
<@h.zTree />
<script type="text/javascript">
jQuery(document).ready(function(){
	//初始化信息
	jQuery("#d_result").combobox("setValue", "1");
	//查询按钮事件
	jQuery("#btn_search").click(function(){
		gridreload();
	});
	//反利信息查询事件
	jQuery("#btn_p_search").click(function(){
		fgridreload();
	});
	//打款按钮事件
	jQuery("#btn_dk").click(function(){
		var rows = jQuery("#f_datagrid").datagrid("getChecked");
		if(rows.length<1){
			jQuery.messager.alert("系统提示","请先择一条反利数据","info");
			return;
		}
		var hefa=true;
		var ids="";
		//循环判断
		jQuery.each(rows,function(index, row){
			if(row.BACK_INFO=="已反"){
				hefa=false;
			}
			ids=ids+row.ID+",";
		});
		if(!hefa){
			jQuery.messager.alert("系统提示","您选中的反利信息有已经打过款的","info");
			return;
		}
		jQuery.ajax({
			async:false,
			type:"post",
			dataType:"json",
			data:{ids:ids},
			url:"dkmon",
			success:function(info){
				if(!info.success){
					jQuery.messager.alert("系统提示",info.message,"warning");
					return;
				}
				//gridreload();
				fgridreload();
			}
		});
	});
});
//会员信息重新加载
function gridreload(){
	var ckb_dk="";
	if(jQuery("#ckb_dk").attr("checked")){
		ckb_dk=1;
	}else{
		ckb_dk=0;
	}
	jQuery("#datagrid").datagrid("reload",{
		name: jQuery("#s_name").textbox("getText"),
		ckb_dk:ckb_dk
	});
}
//点击会员表格事件
function gridClick(index, info){
	jQuery("#userid").val(info.ID);
	jQuery("#d_result").combobox("setValue", "1");
	fgridreload();
}
//反复信息重新加载
function fgridreload(){
	jQuery("#f_datagrid").datagrid("reload",{
		userid: jQuery("#userid").val(),
		back_info:jQuery("#d_result").combobox("getValue")
	});
}
</script>